package com.rfid.a252robot.admin.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.a252robot.R;
import com.rfid.a252robot.admin.bean.Address;
import com.rfid.a252robot.base.BaseAdapter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ChargeAdapter  extends BaseAdapter<ChargeAdapter.MyHolder, Address> {

    public ChargeAdapter(List<Address> data) {
        super(data);
    }

    @Override
    protected void bindView(ChargeAdapter.MyHolder holder, int position) {
        Address address = mData.get(position);
        holder.mapCode.setText(address.getMapCode());
        holder.pointName.setText(address.getPointName());
    }

    @NonNull
    @Override
    public ChargeAdapter.MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ChargeAdapter.MyHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_charge,parent,false));
    }

    class MyHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.mapCode)
        TextView mapCode;
        @BindView(R.id.pointName)
        TextView pointName;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
